<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('物料信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>

                            <li>
                                <label>物料名称：</label>
                                <input type="text" name="productName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:basProduct:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:basProduct:remove')}]];
        var prefix = ctx + "bas/product";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                search: false,
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                singleSelect: true,
                clickToSelect: true,//是否启用点击选中行
                modalName: "物料信息",
                columns: [{
                    checkbox: true
                },
                    {
                        field: 'productGuid',
                        title: 'ID',
                        visible: false
                    },
                    {
                        field: 'productId',
                        title: '物资编码'
                    },
                    {
                        field: 'specialFlag',
                        title: '包装定额',
                        sortable: true
                    },
                    {
                        field: 'productName',
                        title: '物资名称'
                    },
                    {
                        field: 'lkMinkc',
                        title: '最小库存',
                        visible: true
                    },
                    {
                        field: 'lkMaxkc',
                        title: '最大库存',
                        visible: true
                    },
                    {
                        field: 'useable',
                        title: '是否可用',
                        visible: true,
                        formatter: function (value, row, index) {
                            if (value == "Y") {
                                return "可用"
                            }
                            if (value =="N") {
                                return "不可用"
                            }
                        }
                    },
                    {
                        field: 'yxq',
                        title: '有效期',
                        visible: true
                    },
                    {
                        field: 'remark',
                        title: '备注',
                        visible: true
                    },
                ]
            };
            $.table.init(options);
        });

        /* (回调形式-父页面调用子页面) */
        function getSelections() {
            var rows = $("#bootstrap-table").bootstrapTable('getSelections');
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条数据")
                return
            }
            return rows;
        }
    </script>
</body>
</html>